package com.rental.quickenPoint.controller;


import com.rental.common.result.AjaxResult;
import com.rental.model.entity.chargeRecord.ChargeRecord;
import com.rental.quickenPoint.service.IChargeRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hjk
 * @since 2025-01-16
 */
@Tag(name = "加速模块")
@Schema(description = "加速值")
@RestController
@RequestMapping("/charge-record")
public class ChargeRecordController {

    @Autowired
    private IChargeRecordService chargeRecordService;

    /**
     * 公众号广告出租
     * @param chargeRecord
     * @return
     */
    @Operation(summary = "公众号广告出租")
    @PostMapping("/advertising")
    public AjaxResult<Boolean> advertising(@RequestBody ChargeRecord chargeRecord,@RequestParam Long userId) {
        return AjaxResult.success(chargeRecordService.advertising(chargeRecord, userId));
    }

    /**
     * 直连加速
     * @param
     * @return
     */
    @Operation(summary = "直连加速")
    @PostMapping("/connectWay")
    public AjaxResult<Boolean> connectWay(@RequestParam Long userId) {
        return AjaxResult.success(chargeRecordService.connectWay(userId));
    }
    /**
     * 微博广告出租
     * @param chargeRecord
     * @return
     */
    @Operation(summary = "微博广告出租")
    @PostMapping("/advertisingWeiBo")
    public AjaxResult<Boolean> advertisingWeiBo(@RequestBody ChargeRecord chargeRecord,@RequestParam Long userId) {
        return AjaxResult.success(chargeRecordService.advertisingWeiBo(chargeRecord, userId));
    }

    /**
     * 每日签到
     * @return
     */
    @Operation(summary = "每日签到")
    @GetMapping("/sign")
    public AjaxResult<Boolean> sign(@RequestParam Long userId) {
        return AjaxResult.success(chargeRecordService.sign(userId));
    }

    /**
     * 查询加速值明细
     * @param userId
     * @return
     */
    @Operation(summary = "查询加速值明细")
    @PostMapping("/getChargeRecordInfo")
    public AjaxResult<List<ChargeRecord>> getChargeRecordInfo(@RequestParam Long userId) {
        return AjaxResult.success(chargeRecordService.getChargeRecordInfo(userId));
    }

    /***
     * 实名认证
     * @return
     */
    @Operation(summary = "实名认证")
    @GetMapping("/toRegister")
    public AjaxResult<String> toRegister(@RequestParam("userId") Long userId,@RequestParam("idCard") String idCard,@RequestParam("realName") String realName){
        return AjaxResult.success(chargeRecordService.toRegister(userId,idCard,realName));
    }


}
